﻿#pragma once 
#include"Camera.h"
#include<map>
class CameraControl {
public:
	CameraControl();
	~CameraControl();

protected:
	bool mLeftMouseDown = false;
	bool mRightMouseDown = false;
	bool mMiddleMouseDown = false;
	float mCurrentX=0.0f, mCurrentY=0.0f;
	std::map<int, bool> mKeyMap;
	Camera* mCamera = nullptr;
	float mSensitive = 0.2f;//旋转敏感值
	float mSpeed = 0.004f;//平移的速度
	float mScaleSpeed = 0.1f;//缩放的速度
public:   
	virtual void update();
	virtual void onMouse(int button, int action, double xpos,double ypos);
	virtual void onCursor(double xpos, double ypos);
	virtual void onKey(int key, int action, int mods);
	virtual void onScroll(float offset);
	void setCamera(Camera* camera) { mCamera = camera; }
	void setSensitivity(float sen) { mSensitive = sen; }
	void setSpeed(float speed) { mSpeed = speed; }
	void setScaleSpeed(float speed) { mSpeed = speed; }

};